package com.dong.springboot.rabbitmq;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;

/**
 * @author: dong peng
 * @date: 2019/2/20 10:28
 * @description:
 */

public class ConnectionUtil {

    public static Connection getConnection() throws IOException {
        ConnectionFactory connectionFactory = new ConnectionFactory();
        connectionFactory.setHost("19.19.22.52");
        connectionFactory.setPort(5672);
        connectionFactory.setVirtualHost("testHost");
        connectionFactory.setUsername("dong");
        connectionFactory.setPassword("123");

        return connectionFactory.newConnection();
    }
}
